import java.io.FilterOutputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-09-03
 * Time: 16:33
 */
public class Demo32 {
    private static int sum = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                int result = 0;
                for(int i = 1; i <= 1000; i++){
                    result += i;
                }
                sum = result;
            }
        });
        t1.start();
        t1.join();
        System.out.println("sum = " + sum);

    }
}
